<template>
  <div class="body">
    <router-link style="margin-left: 24px;" :to="{path:'/leave/leaveApple'}"><a-button>请假申请</a-button></router-link>
    <router-link :to="{path:'/leave/leaveApproval'}"><a-button>请假审批</a-button></router-link>
    <router-link :to="{path:'/leave/leaveSetting'}"><a-button>老师请假-基础设置</a-button></router-link>
    <a-tabs default-active-key="1" @change="callback">
      <a-tab-pane key="1" tab="请假类型">
        <div class="day-statistics">
          <a-button @click="showAddLeave" type="primary"> <a-icon type="plus" />添加请假类型</a-button>
          <a-modal
            v-model="addLeaveType"
            :title=addLeaveTypeTitle
            width="500px"
            ok-text="确认"
            cancel-text="取消"
            @ok="addLeaveTypeOk"
            @cancel="addLeaveType = false"
          >
            <div class="add-leave">
              <div class="add-leave-tit">所属字典类型：</div>
              <div class="add-leave-desc">老师请假类型</div>
            </div>
            <div class="add-leave add-leave-margin">
              <div class="add-leave-tit"><span style="color: #FF555A;">*</span>类型名称：</div>
              <a-input v-model="addLeaveTypeParams.leaveName" class="add-leave-input" placeholder="请输入"/>
            </div>
          </a-modal>
          <a-table :columns="columns" :data-source="dataList" class="table">
            <span slot="leaveType" slot-scope="scope, record">老师请假类型</span>
            <span slot="leaveStatus" slot-scope="scope, record">
              <a-switch @click="statusSwitch(record)"  :checked="record.leaveStatus === 1 ? true : false" />
            </span>
            <span slot="operation" slot-scope="scope, record">
              <a @click="showEdit(record)">编辑</a>
              <a-divider type="vertical" />
              <a @click="showConfirm(record.id)">删除</a>
            </span>
          </a-table>
        </div>
      </a-tab-pane>

      <a-tab-pane key="2" tab="请假时间" force-render>
        <div class="day-statistics">
          <a-radio-group v-model="timeParams.timeType">
             <a-radio :value="0">时分</a-radio>
             <div v-if="timeParams.timeType == 0" class="time-input">
               <div class="time-input-tit">请假最少时长：</div>
               <a-input v-model="timeParams.timeMinHour" class="time-input-input" placeholder="请输入"/>
               <div class="time-input-tit">&nbsp;小时</div>
             </div>
             <a-radio class="time-up-down" :value="1">上下午</a-radio>
             <a-button v-if="timeParams.timeType == 1" @click="addLeaveTime = true" class="time-up-down-btn" type="primary"><a-icon type="plus" />添加请假时间</a-button>
             <!-- 添加请假时间 -->
             <a-modal
               v-model="addLeaveTime"
               title="添加请假时间"
               width="500px"
               ok-text="确认"
               cancel-text="取消"
               @ok="addLeaveTimeOk"
               @cancel="addLeaveTime = false"
             >
             <div class="add-leave">
               <div class="add-leave-tit"><span style="color: #FF555A;">*</span>名称：</div>
               <a-input v-model="apmData.apmName" class="add-leave-input" placeholder="请输入"/>
             </div>
             <div class="add-leave add-leave-margin">
               <div class="add-leave-tit"><span style="color: #FF555A;">*</span>时间范围：</div>
               <a-time-picker class="add-leave-picker" format="HH:mm" placeholder="请选择时间" @change="addTime($event,1)"/>
               <div class="add-leave-picker-center">至</div>
               <a-time-picker class="add-leave-picker" format="HH:mm" placeholder="请选择时间" @change="addTime($event,2)"/>
             </div>
             </a-modal>
          </a-radio-group>
          <a-table v-if="timeParams.timeType == 1" :columns="columnsTime" :data-source="timeData">
            <span slot="apmStatus" slot-scope="scope, record">
              <a-switch @click="apmStatusSwitch(record)"  :checked="record.apmStatus === 1 ? true : false" />
            </span>
            <span slot="operation" slot-scope="scope, record">
              <a @click="showEdit(record)">编辑</a>
              <a-divider type="vertical" />
              <a @click="showTimeConfirm(record.id)">删除</a>
            </span>
          </a-table>
        </div>
        <a-button type="primary" class="time-input-btn" @click="applicationBtn">应用</a-button>
      </a-tab-pane>
      <a-tab-pane key="3" tab="流程设置">
        <div class="day-statistics">
          <div class="procedure">
            <div class="procedure-setting">
              <div>审批流程：</div>
              <a-switch></a-switch>
            </div>
            <div class="procedure-setting">
              <a-button type="primary" class="procedure-setting-btn">保存</a-button>
              <a-button>取消</a-button>
            </div>
          </div>
          <div class="procedure-setting" @click="procedureSettingDialog = true">
            <div class="procedure-tit">规则设置</div>
            <a-icon class="procedure-icon" type="right" />
          </div>


          <a-modal
            v-model="procedureSettingDialog"
            title="规则设置"
            width="1000px"
            cancel-text="取消"
            ok-text="提交"
          >
            <div class="procedure-setting-tit">1. 异常设置：审批节点内成员离职、为空等情况的处理方式</div>
            <a-radio-group v-model="errorRadio" :default-value="1">
              <a-radio class="procedure-setting-radio" :value="1">不限范围</a-radio>
              <a-radio class="procedure-setting-radio" :value="2">限定范围</a-radio>
            </a-radio-group>
            <div class="procedure-setting-tit procedure-setting-vice-tit">2. 审批人重复：当同一个审批人在流程中出现多次时</div>
            <a-radio-group v-model="approvalRadio" :default-value="1">
              <a-radio class="procedure-setting-radio" :value="1">不去重</a-radio>
              <a-radio class="procedure-setting-radio" :value="2">保留第一个</a-radio>
              <a-radio class="procedure-setting-radio" :value="3">保留最后一个</a-radio>
            </a-radio-group>
            <div class="procedure-setting-tit procedure-setting-vice-tit">3. 自动通过：发起人和审批人是同一个人时</div>
            <a-radio-group v-model="automaticRadio" :default-value="1">
              <a-radio class="procedure-setting-radio" :value="1">自动通过</a-radio>
              <a-radio class="procedure-setting-radio" :value="2">不自动通过</a-radio>
            </a-radio-group>
          </a-modal>
          <!-- <div class="procedure-axis">
            <div class="procedure-black-top">发起人</div>
            <div class="procedure-black-down">权限中配置，无需设置</div>
          </div> -->

          <a-button @click="addCondition = true">流程设置-添加条件</a-button>
          <a-button @click="conditionPeople = true">审批人</a-button>
          <a-button @click="CCPeople = true">抄送人</a-button>


          <a-modal
            v-model="addCondition"
            width="1000px"
            ok-text="提交"
            cancel-text="取消"
          >
            <template slot="title">
              <a-space>
                <span class="add-condition-title">条件</span>
                <a-select default-value="lucy" class="day-form-in">
                  <a-select-option value="jack">
                    Jack
                  </a-select-option>
                  <a-select-option value="lucy">
                    Lucy
                  </a-select-option>
                  <a-select-option value="disabled" disabled>
                    Disabled
                  </a-select-option>
                  <a-select-option value="Yiminghe">
                    yiminghe
                  </a-select-option>
                </a-select>
              </a-space>
            </template>
            <div class="add-condition-warn">
              <a-icon class="add-condition-warn-icon" type="info-circle" />
              <div class="add-condition-warn-desc">多个条件组时，满足其中一条件组个即可。</div>
            </div>
            <div class="add-condition-row">
              <div class="add-condition-tit">发起人：</div>
              <div @click="addConditionSelect = true" class="add-condition-desc">
                <div style="color: #c0bfbf;">请选择</div>
                <a-icon type="down" />
              </div>
              <a-modal
                v-model="addConditionSelect"
                title="添加发起人"
                width="1000px"
                ok-text="提交"
                cancel-text="取消"
              >
              <AddTeacherTree></AddTeacherTree>
              </a-modal>
            </div>
            <div class="add-condition-row">
              <div class="add-condition-tit">请假时长：</div>
              <a-select default-value="lucy" class="day-form-in">
                <a-select-option value="jack">
                  Jack
                </a-select-option>
                <a-select-option value="lucy">
                  Lucy
                </a-select-option>
                <a-select-option value="disabled" disabled>
                  Disabled
                </a-select-option>
                <a-select-option value="Yiminghe">
                  yiminghe
                </a-select-option>
              </a-select>
            </div>
            <div class="add-condition-row">
              <div class="add-condition-tit">请假类型：</div>
               <a-checkbox>事假</a-checkbox>
               <a-checkbox>病假</a-checkbox>
               <a-checkbox>其他</a-checkbox>
            </div>
            <a-button class="add-condition-warn-btn">添加条件</a-button>
            <a-button type="primary" class="add-condition-warn-btn">添加条件组</a-button>
          </a-modal>
          <a-modal
            v-model="conditionPeople"
            title="审批人"
            width="1000px"
            ok-text="提交"
            cancel-text="取消"
          >
          <div>
            <a-radio-group v-model="radioGroup" :default-value="1">
              <a-radio :value="1">指定成员</a-radio>
              <a-radio :value="2">发起人自选</a-radio>
              <a-radio :value="3">上一节点审批人指定</a-radio>
            </a-radio-group>
          </div>
            <template v-if="radioGroup == 2 || radioGroup == 3">
              <div class="condition-people-tit">选择范围</div>
              <a-radio-group v-model="rangeRadio" :default-value="1">
                <a-radio class="condition-people-radio" :value="1">不限范围</a-radio>
                <a-radio class="condition-people-radio" :value="2">限定范围</a-radio>
              </a-radio-group>
            </template>

            <a-button class="condition-people-btn" type="primary" @click="selectPeopleDialog = true">选择成员</a-button>

            <template v-if="radioGroup == 2 || radioGroup == 3">
              <div class="condition-people-tit">选择方式</div>
              <a-radio-group v-model="peopleRadio" :default-value="1">
                <a-radio class="condition-people-radio" :value="1">自选一个人</a-radio>
                <a-radio class="condition-people-radio" :value="2">多选一个人</a-radio>
              </a-radio-group>
            </template>
            <template v-if="radioGroup == 2">
              <div class="condition-people-tit">多人审批时采取的审批方式</div>
              <a-radio-group v-model="modeRadio" :default-value="1">
                <a-radio class="condition-people-radio" :value="1">或签（其中一名审批人同意或拒绝即可）</a-radio>
                <a-radio class="condition-people-radio" :value="2">会签（须所有审批人同意）</a-radio>
              </a-radio-group>
            </template>


            <a-modal
              v-model="selectPeopleDialog"
              title="选择成员"
              width="1000px"
              ok-text="提交"
              cancel-text="取消"
            >
              <AddTeacherTree></AddTeacherTree>
            </a-modal>
            <template v-if="radioGroup == 1">
              <div class="condition-people-tit">部门</div>
              <a-tag class="condition-people-tag">姜九笙</a-tag>
              <div class="condition-people-tit">多人审批时采取的审批方式</div>
              <a-radio-group v-model="modeRadio" :default-value="1">
                <a-radio class="condition-people-radio" :value="1">或签（其中一名审批人同意或拒绝即可）</a-radio>
                <a-radio class="condition-people-radio" :value="2">会签（须所有审批人同意）</a-radio>
              </a-radio-group>
            </template>

            <template v-if="radioGroup == 3">
              <div class="condition-people-desc"  style="margin-top: 40px;">说明</div>
              <div class="condition-people-desc">1.若上一节点为多人会签，由最后一名会签审批人指定下一级审批人</div>
              <div class="condition-people-desc">2.连续审批自动同意时，如果需要指定下一级审批人，则自动同意失效</div>
            </template>
          </a-modal>
          <a-modal
            v-model="CCPeople"
            title="抄送人"
            width="1000px"
            ok-text="提交"
            cancel-text="取消"
          >
          <a-button type="primary" @click="CCPeopleDialog = true">添加抄送人</a-button>
          <a-modal
            v-model="CCPeopleDialog"
            title="添加抄送人"
            width="1000px"
            ok-text="提交"
            cancel-text="取消"
          >
            <AddTeacherTree></AddTeacherTree>
          </a-modal>
          <a-checkbox class="cc-people-checkbox">允许发起人自选</a-checkbox>
          </a-modal>
        </div>
      </a-tab-pane>
    </a-tabs>
  </div>
</template>
<style scoped="scoped" lang="scss">
  .body {
    padding: 24px 0;
  }
  ::v-deep .ant-tabs-nav-container {
    margin-left: 24px;
  }
  .day-statistics {
    margin: 0 24px;
  }
  .table {
    margin-top: 24px;
  }
  .add-leave {
    display: flex;
    align-items: center;
    .add-leave-tit {
      width: 100px;
      text-align: right;
      font-size: 14px;
      font-weight: 400;
      color: #666666;
    }
    .add-leave-desc {
      width: 320px;
      height: 32px;
      background: #F5F7FA;
      border-radius: 4px;
      border: 1px solid #DCDFE6;
      line-height: 32px;
      padding: 0 12px;
      font-weight: 400;
      color: #333333;
      font-size: 14px;
    }
    .add-leave-input {
      width: 320px;
      height: 32px;
    }
    .add-leave-picker {
      width: 140px;
    }
    .add-leave-picker-center {
      width: 40px;
      text-align: center;
    }
  }
  .add-leave-margin {
    margin-top: 24px;
  }
  .time-input {
    display:flex;
    align-items: center;
    margin: 12px 0 0 24px;
    .time-input-tit {
      font-size: 14px;
      font-weight: 400;
      color: #333333;
    }
    .time-input-input {
      width: 66px;
      height: 32px;
      background: #FFFFFF;
      border-radius: 4px;
      border: 1px solid #D9D9D9;
    }
  }
  .time-up-down {
    display: block;
    margin-top: 24px;
  }
  .time-up-down-btn {
    margin: 24px 0;
  }
  .time-input-btn {
    margin: 40px 0 0 24px;
  }
  .procedure {
    display: flex;
    align-items: center;
    justify-content: space-between;
    .procedure-setting {
      display: flex;
      align-items: center;
      .procedure-setting-btn {
        margin-right: 20px;
      }
    }
  }
  .procedure-setting {
    display: flex;
    align-items: center;
    cursor: pointer;
    .procedure-tit {
      margin-top: 20px;
      font-size: 14px;
      font-weight: 400;
      color: #4174FD;
    }
    .procedure-icon {
      margin-top: 20px;
      font-size: 14px;
      color: #4174FD;
    }
  }
  .procedure-axis {
    .procedure-black-top {
      width: 220px;
      height: 44px;
      background: #2B3346;
      border-radius: 4px 4px 0 0;
      font-size: 14px;
      font-weight: 600;
      color: #FFFFFF;
      line-height: 42px;
      padding: 0 16px;
    }
    .procedure-black-down {
      width: 220px;
      height: 54px;
      background: #F2F4FA;
      border-radius: 0 0 4px 4px;
      font-size: 14px;
      font-weight: 400;
      color: #666666;
      line-height: 54px;
      padding: 0 16px;
    }
  }
  .add-condition-title {
    font-size: 16px;
    font-weight: 500;
    color: #333333;
  }
  .add-condition-warn {
    height: 40px;
    background: rgba(65,116,253,0.0800);
    border-radius: 2px;
    border: 1px solid #4174FD;
    display: flex;
    align-items: center;
    padding: 0 13px;
    .add-condition-warn-icon {
      color: #FFFFFF;
      font-size: 14px;
      background: #4174FD;
      border-radius: 50%;
    }
    .add-condition-warn-desc {
      font-size: 14px;
      font-weight: 400;
      color: #666666;
      margin-left: 13px;
    }
  }
  .add-condition-warn-btn {
    margin-top: 24px;
    display: block;
  }
  .add-condition-row {
    display: flex;
    margin: 24px 0;
    .add-condition-tit {
      display: flex;
      align-items: center;
      color: rgba(0, 0, 0, 0.85);
      width: 86px;
      justify-content: end;
    }
    .add-condition-desc {
      height: 32px;
      width: 100%;
      border: 1px solid #d9d9d9;
      border-radius:4px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0 10px;
    }
  }
  .condition-people-btn {
    display: block;
    margin-top: 40px;
  }
  .condition-people-tit {
    font-size: 14px;
    font-weight: 400;
    color: #999999;
    margin-top: 16px;
  }
  .condition-people-desc {
    font-size: 14px;
    font-weight: 400;
    color: #999999;
  }
  .condition-people-tag {
    margin-top: 8px;
  }
  .condition-people-radio {
    display: block;
    margin: 20px 0 0 0;
  }
  .cc-people-checkbox {
    display: block;
    margin-top: 40px;
  }
  .procedure-setting-tit {
    font-size: 14px;
    font-weight: 400;
    color: #666666;
  }
  .procedure-setting-vice-tit {
    margin-top: 20px;
  }
  .procedure-setting-radio {
    font-size: 14px;
    font-weight: 400;
    color: #333333;
    display: block;
    margin: 20px 0;
  }
</style>
<script>
  const columns = [
    {
      title: '类型名称',
      dataIndex: 'leaveName',
    },
    {
      title: '所属字典类型',
      dataIndex: 'leaveType',
      scopedSlots: { customRender: 'leaveType' },
    },
    {
      title: '状态',
      dataIndex: 'leaveStatus',
      scopedSlots: { customRender: 'leaveStatus' },
    },
    {
      title: '操作',
      scopedSlots: { customRender: 'operation' },
    },
  ];
  const columnsTime = [
    {
      title: '名称',
      dataIndex: 'apmName',
    },
    {
      title: '时间范围',
      dataIndex: 'apmStr',
      scopedSlots: { customRender: 'apmStr' },
    },
    {
      title: '状态',
      dataIndex: 'apmStatus',
      scopedSlots: { customRender: 'apmStatus' },
    },
    {
      title: '操作',
      scopedSlots: { customRender: 'operation' },
    },
  ];
  import moment from 'moment';
  import AddTeacherTree from "@/components/addMember/addMember.vue";
  import {
    getLeaveList,
    leaveTypeconfStatus,
    leaveTypeconfRemove,
    leaveTypeconfSave ,
    leaveTypeconfEdit,
    getLeaveTimeconf,
    leaveTimeconfSave,
    leaveTimeapmList,
    leaveTimeapmStatus,
    leaveTimeapmRemove,
    leaveTimeapmSave
  } from '@/api/apply'
  export default {
    components: {AddTeacherTree},
    data() {
      return {
        columns,
        columnsTime,
        list: [],
        param: {},
        nowDay: '',
        oldDay: '',
        workList: [],
        addLeaveType: false,
        addLeaveTime: false,
        addCondition: false,
        addConditionSelect: false,
        conditionPeople: false,
        CCPeople: false,
        selectPeopleDialog: false,
        CCPeopleDialog: false,
        procedureSettingDialog: false,
        radioGroup: 1,
        rangeRadio: 1,
        peopleRadio: 1,
        modeRadio: 1,
        errorRadio: 1,
        approvalRadio: 1,
        automaticRadio: 1,
        dataList: [],
        timeData: [],
        addLeaveTypeParams: {
          id: undefined,
          leaveName: undefined,
          leaveStatus: 0,
        },
        timeParams: {
          timeMinHour: undefined,
          timeType: undefined,
        },
        addLeaveTypeTitle: '',
        apmData: {
          apmEnd: undefined,
          apmStart: undefined,
          apmName: undefined,
          apmStr: undefined,
          apmStatus: 0,
        }
      }
    },
    watch: {

    },
    computed: {

    },
    created() {
      this.getList()
    },
    methods: {
      moment,
      getList() {
        getLeaveList().then(response => {
          this.dataList = response.data
        })
        .catch(() => {

        })
      },
      callback(key) {
        if (key == 1) {
          this.getList()
        } else if (key = 2) {
          this.getLeaveTimeconf()
          this.leaveTimeapmList()
        }
      },
      getLeaveTimeconf() {
        getLeaveTimeconf().then(response => {
          this.timeParams = response.data
        })
        .catch(() => {
        })
      },
      //请假类型状态开关
      statusSwitch(record) {
        console.log("record: ",record);
        record.leaveStatus=record.leaveStatus==0?1:0;
        leaveTypeconfStatus(record.id,record.leaveStatus)
        .then(response => {
          if (response.success) {
            if (record.leaveStatus == 1) {
              this.$message.success('请假类型状态开启成功');
            } else {
              this.$message.success('请假类型状态关闭成功');
            }
          }
        })
        .catch(() => {
          this.$message.error('操作失败');
        })
      },
      //请假时间状态开关
      apmStatusSwitch(record) {
        record.apmStatus=record.apmStatus==0?1:0;
        leaveTimeapmStatus(record.id,record.apmStatus)
        .then(response => {
          if (response.success) {
            if (record.apmStatus == 1) {
              this.$message.success('请假时间状态开启成功');
            } else {
              this.$message.success('请假时间状态关闭成功');
            }
          }
        })
        .catch(() => {
          this.$message.error('操作失败');
        })
      },
      //请假类型删除
      showConfirm(id) {
        this.$confirm({
          title: '是否要删除该请假类型？',
          content: '删除该请假类型后，相关的请假记录将保存。',
          okText: '确定',
          cancelText: '取消',
          onOk:() => {
            console.log('OK');
            leaveTypeconfRemove(id).then(response => {
              if (response.success) {
                this.$message.success('删除成功',2);
                this.getList()
              }
            })
            .catch(() => {
              this.$message.error('删除失败',2);
            })
          },
          onCancel() {
            console.log('Cancel');
          },
          class: 'test',
        });
      },
      //请假时间删除
      showTimeConfirm(id) {
        this.$confirm({
          title: '是否要删除该请假时间？',
          content: '删除该请假时间后，相关的请假记录将保存。',
          okText: '确定',
          cancelText: '取消',
          onOk:() => {
            leaveTimeapmRemove(id).then(response => {
              if (response.success) {
                this.$message.success('删除成功',2);
                this.leaveTimeapmList()
                this.addLeaveTime = false
              }
            })
            .catch(() => {
              this.$message.error('删除失败',2);
              this.addLeaveTime = false
            })
          },
          onCancel() {
            console.log('Cancel');
          },
          class: 'test',
        });
      },
      showAddLeave() {
        this.addLeaveType = true
        this.addLeaveTypeTitle = '添加请假类型'
        this.addLeaveTypeParams.id = undefined
        this.addLeaveTypeParams.leaveName = undefined
      },
      addLeaveTypeOk() {
        if (this.addLeaveTypeTitle == '添加请假类型') {
          leaveTypeconfSave(this.addLeaveTypeParams).then(response => {
            if (response.success) {
              this.addLeaveType = false
              this.$message.success('添加成功',2);
              this.getList()
            }
          })
          .catch(() => {
            this.$message.error('添加失败',2);
          })
        }
        if (this.addLeaveTypeTitle == '编辑') {
          leaveTypeconfEdit(this.addLeaveTypeParams).then(response => {
            if (response.success) {
              this.addLeaveType = false
              this.$message.success('编辑成功',2);
              this.getList()
            }
          })
          .catch(() => {
            this.$message.error('编辑失败',2);
          })
        }
      },
      showEdit(record) {
        this.addLeaveTypeTitle = '编辑'
        this.addLeaveType = true
        console.log('record',record);
        this.addLeaveTypeParams.leaveName = record.leaveName
        this.addLeaveTypeParams.id = record.id
      },
      applicationBtn() {
        leaveTimeconfSave(this.timeParams).then(response => {
          if (response.success) {
            this.$message.success('应用成功',2);
            this.getLeaveTimeconf()
          }
        })
        .catch(() => {
          this.$message.error('应用失败',2);
        })
      },
      leaveTimeapmList() {
        leaveTimeapmList().then(response => {
          if (response.success) {
            this.timeData = response.data
          }
        })
        .catch(() => {

        })
      },
      addTime(e,num) {
        let time = e._d.toString().split(' ')[4].slice(0,5)
        if (num == 1) {
          this.apmData.apmStart = time
        } else {
          this.apmData.apmEnd = time
        }
      },
      //添加请假时间
      addLeaveTimeOk() {
        if (!this.apmData.apmName) return this.$message.error('请输入名称',2);
        if (!this.apmData.apmStart) return this.$message.error('请选择时间范围',2);
        if (!this.apmData.apmEnd) return this.$message.error('请选择时间范围',2);
        if (this.apmData.apmStart.split(':')[0] > this.apmData.apmEnd.split(':')[0]) return this.$message.error('请选择正确时间范围',2);
        if ((this.apmData.apmStart.split(':')[0] == this.apmData.apmEnd.split(':')[0]) && (this.apmData.apmStart.split(':')[1] > this.apmData.apmEnd.split(':')[1])) return this.$message.error('请选择正确时间范围',2);
        this.apmData.apmStr = this.apmData.apmStart + '-' + this.apmData.apmEnd
        leaveTimeapmSave(this.apmData).then(response => {
          if (response.success) {
            this.$message.success('添加成功',2);
            this.leaveTimeapmList()
            this.addLeaveTime = false
          }
        })
        .catch(() => {
            this.$message.error('添加失败',2);
            this.addLeaveTime = false
        })
      }
    }
  }
</script>
